import axios from 'axios';

const apiBaseUrl = 'http://127.0.0.1:17777';

// 创建 axios 实例
const service = axios.create({
  baseURL: apiBaseUrl,
  timeout: 60000, // 请求超时时间
});

// request 请求拦截器
service.interceptors.request.use(
  (config) => {
    // config.headers.Authorization = window.sessionStorage.getItem('token');
    // config.headers['UniTrust-AppId'] = "6a15fb53d5f7402bb4e2c6b6e40cbc0e";
    return config;
  },
  (error) => {
    return Promise.reject(error);
  }
);

// response 响应拦截器
service.interceptors.response.use(
  (response) => {
    return response.data;
  },
  (error) => {
    return Promise.reject(error);
  }
);

export default service;
